home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / glibc-1.09 / glibc-1 / glibc-1.09.1 / sysdeps / unix / bsd / sequent / i386 / sysdep.h < prev   
Encoding:
C/C++ Source or Header  |  1994-07-18  |  2.5 KB  |  79 lines

  1. /* System call interface code for Sequent Symmetry running Dynix version 3.
  2. Copyright (C) 1993 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4.  
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public License as
  7. published by the Free Software Foundation; either version 2 of the
  8. License, or (at your option) any later version.
  9.  
  10. The GNU C Library is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. Library General Public License for more details.
  14.  
  15. You should have received a copy of the GNU Library General Public
  16. License along with the GNU C Library; see the file COPYING.LIB.  If
  17. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  18. Cambridge, MA 02139, USA.  */
  19.  
  20. #include <sysdeps/unix/i386/sysdep.h>
  21.  
  22. /* Get the symbols for system call interrupts.  */
  23. #include <machine/trap.h>
  24.   
  25. /* Use the BSD versions of system calls, by setting the high 16 bits
  26.    of the syscall number (see /usr/include/syscall.h).  */
  27. #define SYS_HANDLER (SYS_bsd << 16)
  28.  
  29. /* Dynix uses an interrupt interface to system calls.
  30.    "int $T_SVCn" are syscall interfaces for 0-6 arg functions.
  31.    (see /usr/include/machine/trap.h).  */
  32.  
  33. #undef    DO_CALL
  34.  
  35. #ifdef    __STDC__
  36. #define DO_CALL(syscall_name, args)                           \
  37.   movl $(SYS_HANDLER | SYS_##syscall_name), %eax;                  \
  38.   int $T_SVC##args;
  39. #else
  40. #define DO_CALL(syscall_name, args)                          \
  41.   movl $(SYS_HANDLER | SYS_/**/syscall_name), %eax;                  \
  42.   int $T_SVC/**/args;
  43. #endif
  44.  
  45. #undef    PSEUDO
  46. #define    PSEUDO(name, syscall_name, args)                      \
  47.   .text;                                      \
  48.   .globl syscall_error;                                  \
  49.   .align 4;                                      \
  50.   ENTRY (name)                                      \
  51.   ARGS (args)                                      \
  52.   DO_CALL (syscall_name, args)                              \
  53.   jb syscall_error
  54.  
  55. /* For one and two-argument calls, Dynix takes the arguments in %ecx and
  56.    %edx.  For 3-6 argument calls, Dynix takes the address of the first
  57.    argument in %ecx.  */
  58.  
  59. #ifdef __STDC__
  60. #define ARGS(n) ARGS_##n
  61. #else
  62. #define ARGS(n) ARGS_/**/n
  63. #endif
  64.  
  65. #define ARGS_0
  66. #define ARGS_1    movl 4(%esp), %ecx;
  67. #define ARGS_2    movl 4(%esp), %ecx; movl 8(%esp), %edx;
  68. #define ARGS_3    leal 4(%esp), %ecx;
  69. #define ARGS_4    ARGS_3
  70. #define ARGS_5    ARGS_3
  71. #define ARGS_6    ARGS_3
  72.   
  73. /* Dynix reverses %ecx and %edx relative to most i386 Unices. */
  74.  
  75. #undef    r1
  76. #define    r1        %ecx    /* Secondary return-value register.  */
  77. #undef    scratch
  78. #define scratch     %edx    /* Call-clobbered register for random use.  */
  79.